Summary
Idempotency means repeated execution has the same effect. Deduplication detects and suppresses repeated messages or requests.
Interview Points
- Idempotency is a property of an operation.
- Deduplication is a mechanism for detecting duplicates.
- Idempotency keys are common for payment and order APIs.
- Deduplication needs a retention window and stable identifiers.
- Together they support safe retries and at-least-once delivery.
2-3 Minute Interview Script
“Idempotency and deduplication are related but different. Idempotency means if the same operation is applied multiple times, the final effect is the same as applying it once. Deduplication means detecting duplicate requests or messages and suppressing repeats.
In a payment API, I would use an idempotency key. If the client retries after a timeout, the server can recognize the same logical operation and return the original result instead of charging twice.
Deduplication typically needs a stable ID and a retention window. It is hard to dedupe forever, so the design must define how long duplicates are remembered.
The senior point is that safe retries require idempotent operations, and deduplication is one practical way to implement them.”
Follow-Ups
- Where do you store idempotency keys?
- What is the dedupe window?